{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-header">编辑数据</div>
    <div class="layui-card-body">
        <form action="{:request()->url()}" class="layui-form" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">* 配置分组</label>
                <div class="layui-input-inline">
                    <select name="group">
                        <option value="">请选择配置分组</option>
                        {foreach name=":config('configGroup')" key="k" item="v"}
                        <option value="{$k}" {if condition="isset($data) and $data.group eq $k"}selected="selected"{/if}>{$v}[{$k}]</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">* 配置标题</label>
                <div class="layui-input-inline">
                    <input type="text" name="title" value="{$data.title|default=''}" autocomplete="off" placeholder="请输入配置标题" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">* 配置标识</label>
                <div class="layui-input-inline">
                    <input type="text" name="name" value="{$data.name|default=''}" autocomplete="off" placeholder="请输入配置标识" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">由英文字母和下划线组成，必须以字母开头</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">* 配置类型</label>
                <div class="layui-input-inline">
                    <select name="type">
                        <option value="">请选择配置类型</option>
                        {foreach name=":config('configType')" key="k" item="v"}
                        <option value="{$k}" {if condition="isset($data) and $data.type eq $k"}selected="selected"{/if}>{$v}[{$k}]</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">默认值</label>
                <div class="layui-input-inline">
                    <input type="text" name="value" value="{$data.value|default=''}" autocomplete="off" placeholder="请输入默认值" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">选项值</label>
                <div class="layui-input-inline">
                    <textarea name="options" autocomplete="off" placeholder="请输入选项值" class="layui-textarea">{$data.options|default=''}</textarea>
                </div>
                <div class="layui-form-mid layui-word-aux">
                此配置仅适用于配置类型为单选项、下拉选项。参考格式如下：<br>
                1:是<br>
                0:否<br>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-filter="*" lay-submit="">保存</button>
                    <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
